/*
  @program : This is header file for Line class including declaration as well as defination,  
              This class provide methods for drawing line using XLIB. 
	          
  @date : 28/07/2006   
  @author : Vishwajeet Dusane
*/




#ifndef LINE_H
#define LINE_H

#include<fstream>
#include<stdlib.h>
#include"MyDisplay.h"
// Draw line

class Line{

public:

   int x1,x2;
   int y1,y2;
   
   double x,y;
   
   MyDisplay *show;
  
//Constructor & Destructor : 

    //default values are assign to x1,x2,y1,y2
   //  Constructor also calls method from MyDisplay class createWindow(...) 

   Line();
   
   //default values are assign to x1,x2,y1,y2
   // Constructor also calls method from MyDisplay class createWindow(...) 

   Line(int , int , int ,int);
   
   //default values are assign to x1,x2,y1,y2
   //  Constructor also calls method from MyDisplay class createWindow(...) 

   Line(int, int);
   
   
   //default values are assign to x1,x2,y1,y2
   //  Constructor also calls method from MyDisplay class createWindow(...) 

   Line(int);
   
   // Get coordinates of line from file  
   Line(const char *fileName);

   //  destructor calls closeDisplay method from MyDisplay class 
   //  
   
   
   Line(const MyDisplay &another);

   ~Line();
 

//methods :

  // Draw line on the screen
   void plot(const double &,const double & );
  
  // get slope of line 
   double getSlope();
  
  // get slope of line with coordinates pass to it
   double getSlope(const int &,const int &, const int &, const int &);
  
  // get delta x i.e. x2-x1
   int getdx();
    
  // get delta y i.e. y2-y1
   int getdy();
   
  // this will swap t	he passed the two numbers
   int swap(int &,int &);
     
  // this will generate pixel for the line and plot it using method plot
   void drawLine();
   
  // this method generate pixel for the line passed as parameter and plot it using method plot
   void drawLine(double, double, double, double); 
    
  //  set starting value of (x1,y1) to passed parameter
   void setX1Y1(int, int);
   
  //  set starting value of (x2,y2) to passed parameter
   void setX2Y2(int, int); 
   
  // set line coordinates from file 
   void setCoordinates(const char *fileName);   
  
};

#endif
